package com.qs.dao;

import java.util.List;

import org.hibernate.Query;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.qs.entities.Channel;

public class ChannelDAO extends BaseHibernateDAO  {

	private static final Logger log = LoggerFactory.getLogger(ChannelDAO.class);
	
	public Channel findById(java.lang.Integer id) {
		log.debug("getting Channel instance with id: " + id);
		try {
			Channel instance = (Channel) getSession().get("com.qs.entities.Channel", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
	
	public List findAll() {
		log.debug("finding all Channel instances");
		try {
			String queryString = "from Channel order by orderIndex";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}
}
